﻿--#include "data\functions\Vip\VipSceneCommon.lua" once   --vip挂机

local npcId = 158
NpcDialog[npcId] = {}
local t = NpcDialog[npcId]

t.main = function(sysarg)
	
	
	local strCond		= Lang.ScriptTips.VipScene001
	local strDesc 		= ""
	local okBtn 		= ""			--{按钮;样式;按钮名;函数名;描述}
	local strBtnList 	= ""

	strDesc = Lang.ScriptTips.VipScene002
	okBtn 		= "{btn;0;".. Lang.ScriptTips.buttonEnter ..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	strBtnList 	= strBtnList .. string.format(okBtn, "Enter")


	local pack = DataPack.allocPacket(sysarg, LogicCmd.npcDialogSys.sysID, LogicCmd.npcDialogSys.sub.sNpcDlgData)
	DataPack.writeUint64(pack, Actor.getNpc(sysarg))
	DataPack.writeByte(pack, NpcDialogType.GeneralNpcDlg)
	DataPack.writeString(pack, strCond)
	DataPack.writeString(pack, strDesc)
	DataPack.writeString(pack, strBtnList)
	DataPack.writeChar(pack, -1)
	DataPack.writeByte(pack, 0);
	DataPack.flush(pack)
end

t.Enter = function(sysarg)
	local config = VipSceneConfig
	local circleLimit= config.levelLimit[1]
	local levelLimit = config.levelLimit[2]
	if not Actor.checkActorLevel( sysarg, levelLimit, circleLimit ) then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.COM0016, ttFlyTip)
		return	
	end

	local vipLimit = config.vipLimit
	local myVip = Actor.getVipGrade(sysarg)
	if myVip < vipLimit then
		Actor.sendTipmsg(sysarg, string.format(Lang.ScriptTips.VipScene003, vipLimit), ttFlyTip)
		return	
	end

	EnterVipScene(sysarg)
end







